package com.itcast.googleplay.utils;

import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.StateListDrawable;

public class DrawableUtil {

	public static Drawable drawableBitmap(int rgb, int radius) {
		GradientDrawable gradientDrawable = new GradientDrawable();
		gradientDrawable.setGradientType(GradientDrawable.RECTANGLE);
		gradientDrawable.setCornerRadius(radius);
		gradientDrawable.setColor(rgb);
		return gradientDrawable;
	}

	public static StateListDrawable getDrawableState(Drawable drawablePress,Drawable drawableNormal) {
		StateListDrawable stateListDrawable = new StateListDrawable();
		stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, drawablePress);
		stateListDrawable.addState(new int[]{}, drawableNormal);
		return stateListDrawable;
	}

}
